i wanna make a WebApp for holy Quran to have an image (surah to arabic , using API) and translation under it
but i cannot find mathematical formulas to find picture from CDN
i’ll be happy if you help me.
my files are here
quran.json
<code>{
"1": [
"الفاتحة",
"Al-Fatihah",
7,
7
],
"2": [
"البقرة",
"Al-Baqarah",
286,
293
],
...
}
</code>
<code>{
"1": [
"الفاتحة",
"Al-Fatihah",
7,
7
],
"2": [
"البقرة",
"Al-Baqarah",
286,
293
],
...
}
</code>
{
"1": [
"الفاتحة",
"Al-Fatihah",
7,
7
],
"2": [
"البقرة",
"Al-Baqarah",
286,
293
],
...
}
(0 and first index : name of surah & second index parts of surah (ayahs) & 3rd index total ayahs from the first)
and here’s a part of my PHP code
<code>$json = json_decode(file_get_contents('quran.json'), true);
$surah = 2
$surah_d = $json["$surah"];
$ayes = $surah_d[2];
$sname = $json["$surah"][0];
$total_ayahs = $surah_d[3];
if ($surah != 1) {
echo "<img src='1_1.png'>";
}
for ($i = 1; $i <= $ayes; $i++) {
echo "<img src='https://cdn.islamic.network/quran/images/$surah"."_"."$i.png'>";
// Corrected API Call & Display:
$ayah_url = "https://api.alquran.cloud/v1/ayah/".abs($total_ayahs-$i-$total_ayahs)."/fa.gharaati";
$ayah_text = json_decode( file_get_contents($ayah_url) , true);
echo '<p>' . $ayah_text['data']['text'] . '</p>';
// return;
}
</code>
<code>$json = json_decode(file_get_contents('quran.json'), true);
$surah = 2
$surah_d = $json["$surah"];
$ayes = $surah_d[2];
$sname = $json["$surah"][0];
$total_ayahs = $surah_d[3];
if ($surah != 1) {
echo "<img src='1_1.png'>";
}
for ($i = 1; $i <= $ayes; $i++) {
echo "<img src='https://cdn.islamic.network/quran/images/$surah"."_"."$i.png'>";
// Corrected API Call & Display:
$ayah_url = "https://api.alquran.cloud/v1/ayah/".abs($total_ayahs-$i-$total_ayahs)."/fa.gharaati";
$ayah_text = json_decode( file_get_contents($ayah_url) , true);
echo '<p>' . $ayah_text['data']['text'] . '</p>';
// return;
}
</code>
$json = json_decode(file_get_contents('quran.json'), true);
$surah = 2
$surah_d = $json["$surah"];
$ayes = $surah_d[2];
$sname = $json["$surah"][0];
$total_ayahs = $surah_d[3];
if ($surah != 1) {
echo "<img src='1_1.png'>";
}
for ($i = 1; $i <= $ayes; $i++) {
echo "<img src='https://cdn.islamic.network/quran/images/$surah"."_"."$i.png'>";
// Corrected API Call & Display:
$ayah_url = "https://api.alquran.cloud/v1/ayah/".abs($total_ayahs-$i-$total_ayahs)."/fa.gharaati";
$ayah_text = json_decode( file_get_contents($ayah_url) , true);
echo '<p>' . $ayah_text['data']['text'] . '</p>';
// return;
}
New contributor
Darg Adege is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.